package bom.example.common.config;

import org.apache.ibatis.logging.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author X.I.O
 * @title: MyBaitsLogConfig
 * @projectName springboot
 * @description: TODO
 * @date 2021/12/2 0:55
 */
public class MyBaitsLogConfig implements Log {

    private Logger log;

    public MyBaitsLogConfig(String clazz) {
        log = LoggerFactory.getLogger(clazz);
    }

    @Override
    public boolean isDebugEnabled() {
//        return log.isDebugEnabled();
        return true; // 默认开启 Debug
    }

    @Override
    public boolean isTraceEnabled() {
//        return log.isTraceEnabled();
        return true; // 默认开启 Trace
    }

    @Override
    public void error(String s, Throwable e) {
        log.error(s,e);
    }

    @Override
    public void error(String s) {
        log.error(s);
    }

    @Override
    public void debug(String s) {
        log.info("debug111"+s);  //SQL 获取参数输出至 info
    }

    @Override
    public void trace(String s) {
        log.info("trace111"+s); //SQL 信息输出至 info
    }

    @Override
    public void warn(String s) {
        log.info(s);
    }

}
